package com.markerhub.service.impl;

import com.markerhub.entity.ManagerStudent;
import com.markerhub.mapper.ManagerStudentMapper;
import com.markerhub.service.ManagerStudentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;


@Service
public class ManagerStudentServiceImpl extends ServiceImpl<ManagerStudentMapper, ManagerStudent> implements ManagerStudentService {
@Autowired
ManagerStudentMapper studentMapper;
    // 获取教师的总学员数
    @Override
    public int countTeacherStudents(Long teacherId) {
        return studentMapper.countTeacherStudents(teacherId);
    }

    @Override
    public List<ManagerStudent> getByIds(List<Integer> studentIds) {
        if (studentIds == null || studentIds.isEmpty()) {
            return Collections.emptyList();  // 如果学生ID列表为空，返回空列表
        }
        return studentMapper.selectByIds(studentIds);
    }
    @Override
    public void batchAudit(List<Integer> studentIds) {
        if (studentIds == null || studentIds.isEmpty()) {
            throw new IllegalArgumentException("学生 ID 列表不能为空");
        }
        studentMapper.batchUpdateStatus(studentIds, "已审核");
    }
}
